from time import sleep

from .models import User
from rest_framework.views import APIView, Response
from celery.task import task


@task
def putUser(username, new_username, password,phone):
    if User.objects.filter(username=username):
        User.objects.update(username=new_username, password=password,phone=phone)
        return {'msg': '修改成功', 'code': '200'}
    return {'msg': '用户不存在', 'code': '400'}